home *** CD-ROM | disk | FTP | other *** search
- class XMLConstructNode
- {
- var attributes;
- var nodeName;
- var _value;
- function XMLConstructNode()
- {
- }
- function appendChild(nName, sObj)
- {
- if(!(this[nName] instanceof Array))
- {
- this[nName] = [];
- this[nName].__resolve = this.getFirstElement;
- }
- sObj.nodeName = nName;
- this[nName].unshift(sObj);
- }
- function addAttribute(aName, aData)
- {
- if(this.attributes == undefined)
- {
- this.attributes = {};
- }
- this.attributes[aName] = aData;
- }
- function toXMLNode()
- {
- var _loc4_ = undefined;
- var _loc2_ = undefined;
- var _loc5_ = undefined;
- var _loc3_ = undefined;
- _loc4_ = new XML();
- _loc3_ = _loc4_.createElement(this.nodeName);
- for(_loc2_ in this.attributes)
- {
- _loc3_.attributes[_loc2_] = this.attributes[_loc2_];
- }
- _loc4_.appendChild(_loc3_);
- _loc5_ = _loc4_.createTextNode(this._value);
- _loc3_.appendChild(_loc5_);
- return _loc3_;
- }
- function getFirstElement(f)
- {
- return this[0][f];
- }
- function parseConstruct(xObj, doc)
- {
- var _loc6_ = undefined;
- var _loc4_ = undefined;
- var _loc3_ = undefined;
- var _loc2_ = undefined;
- var _loc8_ = undefined;
- var _loc9_ = undefined;
- for(_loc6_ in xObj)
- {
- _loc3_ = xObj[_loc6_];
- if(_loc3_ instanceof Array)
- {
- for(_loc4_ in _loc3_)
- {
- _loc2_ = _loc3_[_loc4_];
- if(_loc2_ instanceof XMLConstructNode)
- {
- doc.appendChild(_loc2_.toXMLNode());
- doc.lastChild.appendChild(this.parseConstruct(_loc2_,new XML()));
- }
- }
- }
- }
- return doc;
- }
- function toXML()
- {
- return this.parseConstruct(this,new XML());
- }
- }
-